﻿using System;
using System.Collections.Generic;
using System.Text;

namespace NP.BPMReportPlatform.AuthorizationUserManager.Dtos
{
    public static class PermissionCacheConsts
    {
        public static string CacheProviderKey = "redis";


        public static string BaseKey = "Permissions";

        /// <summary>
        /// 用户权限
        /// <remarks>Client:{clientId}</remarks>
        /// </summary>
        public static string UserPermissionsKey(Guid tenantId) => $"{BaseKey}:UserPermissions:{tenantId}:userId*";

        /// <summary>
        /// 用户权限
        /// <remarks>Client:{clientId}</remarks>
        /// </summary>
        public static string UserPermissionsKey(Guid tenantId, Guid userId) => $"{BaseKey}:UserPermissions:{tenantId}:userId:{userId}";

        /// <summary>
        /// 用户权限
        /// <remarks>Client:{clientId}</remarks>
        /// </summary>
        public static string UserInterfacesKey(Guid tenantId) => $"{BaseKey}:UserInterfaces:{tenantId}:userId*";

        /// <summary>
        /// 用户接口权限
        /// <remarks>Client:{clientId}</remarks>
        /// </summary>
        public static string UserInterfacesKey(Guid tenantId, Guid userId) => $"{BaseKey}:UserInterfaces:{tenantId}:userId:{userId}";

        /// <summary>
        /// Client权限
        /// </summary>
        public static string ClientInterfacesKey(Guid tenantId, string clientId) => $"{BaseKey}:ClientInterfaces:{tenantId}:{clientId}";

        /// <summary>
        /// 模块缓存
        /// </summary>
        /// <param name="tenantId"></param>
        /// <param name="formModuleId"></param>
        /// <returns></returns>
        public static string FormModulesKey(Guid tenantId, Guid formModuleId) =>
            $"{BaseKey}:FormModules:{tenantId}:{formModuleId}";

        /// <summary>
        /// 滑动过期时间
        /// </summary>
        public static int CacheSlidingExpirationDays = 1;
    }
}
